from flask import Flask, render_template
import datetime
import request

app = Flask(__name__)



#这个Python函数是一个Web应用程序的路由函数，使用了Flask框架。
# 它将URL路径'/'与一个函数hello_world()关联起来，
# 当用户访问网站的根目录时，这个函数将被调用并返回字符串'Hello World!'作为响应。
# @app.route('/')    #注解方便进行开发
# def hello_world():  # put application's code here
#     return 'return132'

# @app.route('/user/<name>')
# def welcome2(name):
#     return "你的名字是%s"%name
#
# @app.route('/user/<int:id>')
# def welcome3(id):
#     return "你的编号是%d"%id
#
# @app.route('/user/<float:height>')
# def welcome4(height):
#     return "你的身高是%f"%height

#jinja2 模板

# @app.route('/')
# def index():
#     return render_template('index.html')


# @app.route('/')
# def index():
#     todaytime = datetime.date.today()
#     name = ['张三','李四','王五',"wangwu"]
#     mission = {"擦地":"擦地","洗衣服":"洗衣服","做饭":"做饭"}
#     return render_template('index.html',time = todaytime,name = name,mission = mission)



@app.route('/register')
def register():
    return render_template('test/register.html')

@app.route('/result',methods=['POST','GET'])
def result():
    if request.method == 'POST':
        result = request.form
        print(result)
    return render_template('test/result.html',result =result)


#run方法启动服务器
if __name__ == '__main__':
    app.run()
